package
{
	import com.greensock.TweenLite;
	import com.greensock.easing.Cubic;
	
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	
	import qnx.events.QNXApplicationEvent;
	import qnx.system.QNXApplication;

	[SWF(frameRate="30")]
	public class Box2DBlackBerry extends Box2D
	{
		private var menu:Sprite = new Sprite();
		
		public function Box2DBlackBerry()
		{
			super();
			
			menu.graphics.beginFill(0x000000, 0.4);
			menu.graphics.drawRect(0,0,stage.stageWidth, stage.stageHeight);
			menu.y = -menu.height;
			
			
			this.addChild(menu);
			
			QNXApplication.qnxApplication.addEventListener(QNXApplicationEvent.SWIPE_DOWN, showAppMenu);

		}
		
		override protected function addCounterGravity(event:MouseEvent):void
		{
			super.addCounterGravity(event);
			hideAppMenu();
		}
		
		private function showAppMenu(e:QNXApplicationEvent):void
		{
			
			TweenLite.to(menu, 1, {y:0, ease:Cubic.easeOut});
		}
		
		private function hideAppMenu():void
		{
			TweenLite.to(menu, 1, {y:-menu.height, ease:Cubic.easeOut});
		}
	}
}